// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.core.skinnedmodel.animation;

import zombie.core.skinnedmodel.model.SkinningBone;
import zombie.core.skinnedmodel.model.SkinningData;
import zombie.util.StringUtils;

public final class AnimationBoneBindingPair {
    public final AnimationBoneBinding boneBindingA;
    public final AnimationBoneBinding boneBindingB;

    public AnimationBoneBindingPair(String boneA, String boneB) {
        this.boneBindingA = new AnimationBoneBinding(boneA);
        this.boneBindingB = new AnimationBoneBinding(boneB);
    }

    public void setSkinningData(SkinningData skinningData) {
        this.boneBindingA.setSkinningData(skinningData);
        this.boneBindingB.setSkinningData(skinningData);
    }

    public SkinningBone getBoneA() {
        return this.boneBindingA.getBone();
    }

    public SkinningBone getBoneB() {
        return this.boneBindingB.getBone();
    }

    public boolean isValid() {
        return this.getBoneA() != null && this.getBoneB() != null;
    }

    public boolean matches(String boneA, String boneB) {
        return StringUtils.equalsIgnoreCase(this.boneBindingA.boneName, boneA) && StringUtils.equalsIgnoreCase(this.boneBindingB.boneName, boneB);
    }

    public int getBoneIdxA() {
        return getBoneIdx(this.getBoneA());
    }

    public int getBoneIdxB() {
        return getBoneIdx(this.getBoneB());
    }

    private static int getBoneIdx(SkinningBone skinningBone) {
        return skinningBone != null ? skinningBone.Index : -1;
    }

    public String toString() {
        String string = System.lineSeparator();
        return this.getClass().getName()
            + string
            + "{"
            + string
            + "\tboneBindingA:"
            + StringUtils.indent(String.valueOf(this.boneBindingA))
            + string
            + "\tboneBindingB:"
            + StringUtils.indent(String.valueOf(this.boneBindingB))
            + string
            + "}";
    }
}
